package com.exam.service.impl;

import java.util.List;
import java.util.Set;

import javax.annotation.Resource;

import com.exam.dao.UserDao;
import com.exam.model.User;
import com.exam.service.IUserService;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.plugins.Page;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;

import org.springframework.stereotype.Service;

/**
 * <p>
 * 用户表 服务实现类
 * </p>
 * 
 * @author weirdor
 * @since 2017-06-15
 */
@Service
public class UserServiceImpl extends ServiceImpl<UserDao, User> implements
		IUserService {
	 @Resource
	private UserDao userDao;

	public User selectByUsername(EntityWrapper<User> ew) {
		// TODO Auto-generated method stub
		return userDao.getUserByusername(ew);
	}


	public Set<String> findRoles(String username) {
		// TODO Auto-generated method stub
		return userDao.findRoles(username);
	}

	public Set<String> findPermissions(String username) {
		// TODO Auto-generated method stub
		return userDao.findPermissions(username);
	}

	public Page<User> selectUserPage(Page<User> page) {
	    page.setRecords(userDao.selectUserList(page));
	    return page;
	}


	public User selectUser(String username) {
		// TODO Auto-generated method stub
		return userDao.selectUser(username);
	}


	public User selectUserId(Long id) {
		// TODO Auto-generated method stub
		return userDao.selectUserId(id);
	}


	



}
